home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows5 / xwinc100.zip / CONTRIB-.00 / CONTRIB- / contrib / examples / PEX / six_views.c < prev    next >
C/C++ Source or Header  |  1991-02-16  |  4KB  |  143 lines

  1. /* $XConsortium: six_views.c,v 5.1 91/02/16 09:32:21 rws Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright (c) 1991 by Sun Microsystems, Inc. and the X Consortium.
  5.  
  6.                         All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its 
  9. documentation for any purpose and without fee is hereby granted, 
  10. provided that the above copyright notice appear in all copies and that
  11. both that copyright notice and this permission notice appear in 
  12. supporting documentation, and that the names of Sun Microsystems,
  13. the X Consortium, and MIT not be used in advertising or publicity 
  14. pertaining to distribution of the software without specific, written 
  15. prior permission.  
  16.  
  17. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
  18. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT 
  19. SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
  20. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27. /*  six_views.c - This program demonstrates the six default
  28.            view representations setup by the PEX-SI API.
  29. */
  30.  
  31. #include    <phigs/phigs.h>
  32.  
  33. #define        WS    1     /* workstation id */
  34. #define        LINE_1    10     /* structure ids */
  35. #define        LINE_2    20
  36. #define        DEF_VIEW 7
  37. #define        VIEW_1    1
  38. #define        VIEW_2    2     
  39. #define        VIEW_3    3 
  40. #define        VIEW_4    4
  41. #define        VIEW_5    5
  42.  
  43. static Ppoint3    octagon[] = {
  44.             {0.25, 0.0, 0.5},
  45.             {0.75, 0.0, 0.5},
  46.             {1.0, 0.25, 0.5},
  47.             {1.0, 0.75, 0.5},
  48.             {0.75, 1.0, 0.5},
  49.             {0.25, 1.0, 0.5},
  50.             {0.0,  0.75, 0.5},
  51.             {0.0, 0.25, 0.5},
  52.         };
  53.  
  54. main(argc, argv)
  55. int    argc;
  56. char    *argv[];
  57. {
  58.     Ppoint_list3 colored_line, oct_list;
  59.  
  60.     popen_phigs(0,PDEF_MEM_SIZE);
  61.     popen_ws(1,NULL,phigs_ws_type_x_tool);
  62.  
  63.     oct_list.num_points = 8;
  64.     oct_list.points = octagon;
  65.  
  66.     popen_struct(DEF_VIEW);
  67.         pset_int_colr_ind(1);
  68.         pset_int_style(PSTYLE_HOLLOW);
  69.         pfill_area3(&oct_list);
  70.     pclose_struct();
  71.  
  72.     popen_struct(VIEW_1);
  73.         pset_view_ind(1);        
  74.         pset_int_colr_ind(1);
  75.         pset_int_style(PSTYLE_SOLID);
  76.         pfill_area3(&oct_list);
  77.     pclose_struct();
  78.  
  79.     popen_struct(VIEW_2);
  80.         pset_view_ind(2);        
  81.         pset_int_colr_ind(2);
  82.     pset_int_style(PSTYLE_HOLLOW);
  83.         pfill_area3(&oct_list);
  84.     pclose_struct();
  85.  
  86.     popen_struct(VIEW_3);
  87.         pset_view_ind(3);        
  88.         pset_int_colr_ind(3);
  89.     pset_int_style(PSTYLE_HOLLOW);
  90.         pfill_area3(&oct_list);
  91.     pclose_struct();
  92.  
  93.     popen_struct(VIEW_4);
  94.         pset_view_ind(4);        
  95.         pset_int_colr_ind(4);
  96.         pfill_area3(&oct_list);
  97.     pclose_struct();
  98.  
  99.     popen_struct(VIEW_5);
  100.         pset_view_ind(5);        
  101.         pset_int_colr_ind(5);
  102.         pfill_area3(&oct_list);
  103.     pclose_struct();
  104.  
  105.     pmessage(WS, "please position this message window\n");
  106.     sleep(10);
  107.  
  108.     ppost_struct(WS, DEF_VIEW, 0.0);
  109.     pmessage(WS, " Default View - front  \n" );
  110.     sleep(5);
  111.     punpost_struct(WS, DEF_VIEW);
  112.  
  113.     ppost_struct(WS, VIEW_1, 0.0);
  114.     pmessage(WS, " View 1 - front scaled \n" );
  115.     sleep(5);
  116.     punpost_struct(WS, VIEW_1);
  117.  
  118.     ppost_struct(WS, VIEW_2, 0.0);
  119.     pmessage(WS, " View 2 - top \n" );
  120.     sleep(5);
  121.     punpost_struct(WS, VIEW_2);
  122.  
  123.     ppost_struct(WS, VIEW_3, 0.0);
  124.     pmessage(WS, " View 3 - right side \n" );
  125.     sleep(5);
  126.     punpost_struct(WS, VIEW_3);
  127.  
  128.     ppost_struct(WS, VIEW_4, 0.0);
  129.     pmessage(WS, " View 4 - off-axis \n" );
  130.     sleep(5);
  131.     punpost_struct(WS, VIEW_4);
  132.  
  133.     ppost_struct(WS, VIEW_5, 0.0);
  134.     pmessage(WS, " View 5 - perspective off-axis \n" );
  135.     sleep(5);
  136.     punpost_struct(WS, VIEW_5);
  137.  
  138.     pclose_ws(WS);
  139.     pclose_phigs();
  140. }
  141.  
  142.  
  143.